<template>
	<view class="all" :style="{height:height}">
		<image src="../../../static/icon@2x.png" class="logo"></image>
		<view class="ewm">
			<image src="http://shedehui.club/api/Qrcode/image?content=54321654564&size=134" mode="">
			</image>
		</view>
		<button type="default" class="bcimg" @click="bcimg">保存二维码到相册</button>
		<p class="text1">钱包地址</p>
		<p class="address">{{address}}</p>
		<p class="text2">当前币种单笔充值最小到数量：0，低于该数量充币
			将不会到账</p>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: '充币',
				coin_type_id: "",
				address: "", //充值地址
				height: ""
			}
		},
		onLoad(e) {
			this.coin_type_id = e.id
			uni.getSystemInfo({
				success: function(res) {
					this.height = res.windowHeight
					console.log()
				}
			});
		},
		onShow() {
			this.coin()
		},
		methods: {
			//获取充值地址
			coin() {
				let _this = this
				if (_this.coin_type_id) {
					let datas = {
						coin_type_id: _this.coin_type_id
					}
					this.$api.coinLianList(datas).then(res => {
						_this.address = res.data.data[0].address
					})
				}


			},
			bcimg() {
				uni.saveImageToPhotosAlbum({
					filePath: "http://shedehui.club/api/Qrcode/image?content=http%3A%2F%2Fwww.baidu.com&size=134",
					success: function() {
						console.log('save success');
					}
				});
			}
		}
	}
</script>

<style lang="less">
	.all {
		margin: 0;
		padding: 0;
		width: 100%;
		background: #F2F1F5;
		text-align: center;

		.logo {
			margin-top: 80rpx;
			width: 74rpx;
			height: 72rpx;
		}

		.ewm {
			width: 328rpx;
			height: 328rpx;
			background: #DAE1F9;
			margin: 0 auto;
			padding: 30rpx 30rpx;
			margin-top: 44rpx;

			image {
				width: 268rpx;
				height: 268rpx;
			}
		}

		.bcimg {
			width: 338rpx;
			height: 96rpx;
			background: #764CFA;
			opacity: 1;
			border-radius: 56rpx;
			font-size: 24rpx;
			color: #FFFFFF;
			line-height: 96rpx;
			margin-top: 66rpx;
		}

		.text1 {
			font-size: 24rpx;
			color: #000000;
			margin-top: 34rpx;
		}

		.address {
			font-size: 24rpx;
			color: #171717;
			margin-top: 36rpx;
		}
		.text2{
			font-size: 24rpx;
			color: #EF3B3B;
			margin-top: 70rpx;
		}
	}
</style>
